
#ifndef _MEMBER_BCONEARRESTRAINT_H_
#define _MEMBER_BCONEARRESTRAINT_H_

#include <BRange>
#include <BNode>
#include <BFixedRestraint>

#define fixed_member(conear)		((member_BFixedRestraint*)((BFixedRestraint*)conear)->_ptr)

namespace BWE
{
	struct FixedLimit
	{
		bool limited = false;
		BReal limitError = 0;
	};

	struct RotLimit
	{
		bool limited = false;
		BReal limitError = 0;
	};


	class member_BFixedRestraint
	{
	public:
		member_BFixedRestraint(BFixedRestraint* restraint);
		~member_BFixedRestraint();

		void calculateTransforms();

		BFixedRestraint* boss;
		BVector			rotation;

		BVector			calculatedAxis[3];
		FixedLimit		linearLimits[3];
		RotLimit		angularLimits[3];
		bool			springEnabled[6];
		BReal			equilibriumPoint[6];
		BReal			springStiffness[6];
		BReal			springDamping[6];

		BReal			timeStep;
		BVector			angularPos;
		BVector			linearPos;
		BVector			debugAxis[4];
		bool			useLinearReferenceFrameA;
	};
}

#endif
